package com.xbh.file.api;

import com.alibaba.fastjson.JSONObject;
import com.xbh.common.web.core.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @program: file-center
 * @description:
 * @author: 许宝华
 * @create: 2021-12-01 10:33
 */

@FeignClient(value = "file-center")
public interface FileTransferFeignClient {

    /**
     * 上传
     * @param params
     * @return
     */
    @PostMapping("/file/upload")
    Result fileUpload(@RequestBody JSONObject params);


    /**
     * 下载
     * @param params
     * @return
     */
    @PostMapping("/file/download")
    Result fileDownload(@RequestBody JSONObject params);


    /** 上传图片
     * @param file
     * @return
     */
    @PostMapping(value = "/file/uploadPicture",consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces =  MediaType.APPLICATION_PROBLEM_JSON_VALUE)
    Result uploadPicture(@RequestPart("file") MultipartFile file);

}
